import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import asyncRouter from './router/asyncRouter'
import store from './store/index'
import { useMenuStore } from '@/store/menu'
import '@/plugins/elementUi.js'
import '@/assets/index'
import '@/assets/css/main.css'

const app = createApp(App)
app.use(store)
const menuStore = useMenuStore()
// router.addRoutes(asyncRouter)
// 设置菜单和面包屑数据
menuStore.setPureRouter(asyncRouter).then(() => {
  menuStore.setSidebarMenu()
  menuStore.setBreadCrumb()
})
asyncRouter.forEach(route => {
  router.addRoute(route)
})
app.use(router)

app.mount('#app')
